import java.util.Scanner;
import com.engine.view.Terminal;
import com.ressource.ColoredString;

/**
 * @author jonathan
 * @author fabienne
 */
public class JMeta
{

	/**
	 * 
	 */
	public static void startMessageGame()
	{
		ColoredString welcome = new ColoredString("Bienvenue");
		welcome.cyan();
		System.out.println(welcome);

	}

	/**
	 * @return
	 */
	public static Integer menu()
	{
		Scanner scan = new Scanner(System.in);
		Integer myChoice = 0;
		ColoredString myChoiceColored = new ColoredString(myChoice);

		System.out.println("Choose a number between 1 - 3");
		System.out.println("1 - Launch the Game");
		System.out.println("2 - Show rules");
		System.out.println("3 - Exit");
		myChoice = scan.nextInt();
		myChoiceColored.setOriginalString(myChoice);
		myChoiceColored.blue();
		System.out.println("Your choice: " + myChoiceColored);
		return myChoice;
	}

	/**
	 * 
	 */
	public static void rules()
	{

	}

	/**
	 * 
	 */
	public static void invalidChoice()
	{
		ColoredString message = new ColoredString("Invalid choice retry again");
		message.red();
		System.out.println(message);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		Boolean continueGame = true;
		Integer choiceMenu = 0;
		if (args.length >= 1 && args[0].equals("--nogui"))
		{

			startMessageGame();

			while (continueGame)
			{
				choiceMenu = menu();
				switch (choiceMenu)
				{
					case 1:
					{
						Terminal terminal = new Terminal();
						terminal.start();
						continueGame = true;
						break;
					}
					case 2:
					{
						rules();
						continueGame = true;
						break;
					}
					case 3:
					{
						continueGame = false;
						break;
					}
					default:
					{
						invalidChoice();
						continueGame = true;
						break;
					}
				}
			}
		}
		else
		{
			System.out.println("Usage: java JMeta --nogui");
			System.out.println("\t--nogui\tfor launch game in terminal");
			System.out.println("\t--gui\toption not yet implemented");
		}
	}
}